<div class="tweet-wrap micropost" data-behavior="external_links">
  <div class="tweet entry-main-tweet">
    <header class="tweet-header">
      <div class="profile-wrap">
        <div class="profile-image-wrap">
          <%= link_to micropost.micropost.author_url, target: "_blank", title: "Author’s Website", class: "profile-image" do %>
            <%= image_tag_with_fallback(image_url("favicon-profile-default.png"), RemoteFile.signed_url(micropost.micropost.author_avatar), size: "47x47", alt: "") %>
          <% end %>
        </div>
        <div class="grow flex gap-4 space-between items-last-baseline">
          <div class="grow">
            <div class="profile-info">
              <h1>
                <a href="<%= micropost.fully_qualified_url %>" target="_blank" class="link" id="source_link">
                  <strong><%= micropost.micropost.author_name %></strong>
                  <%= micropost.micropost.author_display_username %>
                </a>
              </h1>
              <p class="post-meta">
                <%= link_to micropost.fully_qualified_url, target: "_blank", title: "View post" do %>
                  <time datetime="<%= micropost.published.iso8601 %>">
                    <%= micropost.published.to_formatted_s(:full_human) %>
                  </time>
                <% end %>
              </p>
            </div>
          </div>
        </div>
      </div>
    </header>
    <div class="tweet-body content-styles">
      <div class="micropost-wrap micropost-text">
        <%=
        begin
          ContentFormatter.format!(micropost.content).html_safe
        rescue => e
          Rails.logger.info { e.inspect }
          content_tag(:p, '&ndash;&ndash;'.html_safe)
        end
        %>
      </div>
      <% micropost.media.each do |media| %>
        <% if media.type =~ /image/i %>
          <%= link_to media.url do %>
            <%= image_tag camo_link(media.url), class: "responsive full-width-candidate" %>
          <% end %>
        <% elsif media.type =~ /video/i %>
          <%= video_tag media.url, preload: "none"  %>
        <% end %>
      <% end %>
    </div>
  </div>
</div>

<% if micropost.respond_to?(:urls) %>
  <div class="tweet-wrap">
    <% micropost.urls.each do |url| %>
      <%= render partial: "shared/link_embed", locals: {url: url, entry: micropost} %>
    <% end %>
  </div>
<% end %>